const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {


    //代理访问网易云音乐api服务器
    app.use(createProxyMiddleware('/163api', {
        target: 'http://localhost:2233/',
        secure: false,
        changeOrigin: true,
        pathRewrite: {
            "^/163api": "/163api"
        }
    }))
    //代理访问QQ音乐api服务器
    app.use(createProxyMiddleware('/qqapi', {
        target: 'http://localhost:2233/',
        secure: false,
        changeOrigin: true,
        pathRewrite: {
            "^/qqapi": "/qqapi"
        }
    }))
    //代理访问咪咕音乐api服务器
    app.use(createProxyMiddleware('/miguapi', {
        target: 'http://localhost:2233/',
        secure: false,
        changeOrigin: true,
        pathRewrite: {
            "^/miguapi": "/miguapi"
        }
    }))
    //代理访问bilibiliapi服务器
    app.use(createProxyMiddleware('/biliapi', {
        target: 'http://localhost:2233/',
        secure: false,
        changeOrigin: true,
        pathRewrite: {
            "^/biliapi": "/biliapi"
        }
    }))
    //代理访问酷狗服务器
    app.use(createProxyMiddleware('/kugouapi', {
        target: 'http://localhost:2233/',
        secure: false,
        changeOrigin: true,
        pathRewrite: {
            "^/kugouapi": "/kugouapi"
        }
    }))
    //代理访问酷我服务器
    app.use(createProxyMiddleware('/kuwoapi', {
        target: 'http://localhost:2233/',
        secure: false,
        changeOrigin: true,
        pathRewrite: {
            "^/kuwoapi": "/kuwoapi"
        }
    }))

}
